import Vue from 'vue'
import Router from 'vue-router'
import { touch } from 'shelljs'
import { Form } from 'element-ui'
import store from '../store/store'
const login = () => import('../views/login')

Vue.use(Router)

const originalPush = Router.prototype.push
const originalReplace = Router.prototype.replace
Router.prototype.push = function push (location) {
  return originalPush.call(this, location).catch((err) => err)
}
Router.prototype.replace = function replace (location) {
  return originalReplace.call(this, location).catch((err) => err)
}

const routes = [
  {
    path: '/',
    name: login,
    component: login
  },
  {
    path: '/home',
    name: 'home',
    component: () => import('../views/index'),
    redirect: '/innerTransfer',
    children: [{
      path: '/innerTransfer',
      name: 'innerTransfer',
      component: () => import('../views/innerTransfer')
    },
    {
      path: '/interTransfer',
      name: 'interTransfer',
      component: () => import('../views/interTransfer')
    },
    {
      path: '/balanceInquiry',
      name: 'balanceInquiry',
      component: () => import('../views/balanceInquiry')
    },
      {
      path: '/transactionFlow',
      name: 'transactionFlow',
      component: () => import('../views/transactionFlow')
      }]
  }
]

const router = new Router({
  routes: routes
})

export default router
